package com.aaa.controller.log;

import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONUtil;
import com.aaa.controller.BaseController;
import com.aaa.entity.log.Log;
import com.aaa.entity.system.PageOrder;
import com.aaa.service.log.LogService;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

/**
 * (Log)表控制层
 *
 * @author makejava
 * @since 2022-09-06 19:08:46
 */
@RestController
@RequestMapping("log")
public class LogController extends BaseController {
    /**
     * 服务对象
     */
    @Autowired
    private LogService logService;
    @RequestMapping("queryAll.do")
    public String queryAll(PageOrder pageOrder ) {
        Page page = logService.selectLog(pageOrder );
        JSONConfig jsonConfig = JSONConfig.create();
        jsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
        String jsonStr = JSONUtil.toJsonStr(success(page.getTotal(), page.getResult()), jsonConfig);
        return jsonStr;
    }



    //用户查询页面
    @RequestMapping("toShowLog.do")
    public ModelAndView toShowUser(ModelAndView modelAndView){
        modelAndView.setViewName("log/showLog");
        return modelAndView;
    }
   /*
    @RequestMapping("insert.do")
    public ResponseEntity<Log> insert(Log log){
        Log insertLog = logService.insertLog(log);
      return   ResponseEntity.ok(insertLog);
    }*/

}

